﻿using zk312.DAL;
using zk312.MODEL;

namespace zk312.BLL
{
    public class Roombll
    {
        public Roomdal Roomdal { get; }

        public Roombll(Roomdal roomdal)
        {
            Roomdal = roomdal;
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="room"></param>
        /// <returns></returns>
        public int AddRoom(Room room)
        {
            try
            {
                return Roomdal.AddRoom(room);
            }
            catch (Exception)
            {

                throw;
            }

        }

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="index"></param>
        /// <param name="size"></param>
        /// <param name="name"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public dynamic GetRoom(int index, int size, string? name, string? type)
        {
            try
            {
                return Roomdal.GetRoom(index, size, name, type);
            }
            catch (Exception)
            {

                throw;
            }

        }

        /// <summary>
        /// 逻辑删
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public dynamic DelRoom(int id)
        {
            try
            {
               return Roomdal.DelRoom(id);
            }
            catch (Exception)
            {

                throw;
            }

        }

        /// <summary>
        /// 修改第一步 先查
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public dynamic Getid(int id)
        {
            try
            {
                return Roomdal.Getid(id);
            }
            catch (Exception)
            {

                throw;
            }

        }

        /// <summary>
        /// 修改第二部 修改
        /// </summary>
        /// <param name="room"></param>
        /// <returns></returns>
        public dynamic UpdRoom(Room room)
        {
            try
            {
                return Roomdal.UpdRoom(room);
            }
            catch (Exception)
            {

                throw;
            }

        }
    }
}